package org.jeecg.report.controller;

import com.baomidou.dynamic.datasource.annotation.DS;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.jeecg.common.api.vo.Result;
import org.jeecg.report.dto.MaterialScrapDTO;
import org.jeecg.report.service.IMesCalculateScrapNumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * @author lichunyang
 * @ClassName QisSpcController
 * @Description SPC控制器
 */
@RestController
@AllArgsConstructor
@RequestMapping(value = "/report/calculateScrapNum")
public class MesCalculateScrapNumController {
    @Autowired
    private IMesCalculateScrapNumService iMesCalculateScrapNumService;
    @RequestMapping("/getCalculateScrapNum")
    @DS("history")
    @ApiOperation(value = "获取原料报废统计", notes = "传入qmSpcParameterVO")
    public Result<List<MaterialScrapDTO>> getCalculateScrapNum(@RequestParam Map<String, Object> param) {
        return iMesCalculateScrapNumService.getCalculateScrapNum(param);
    }


    /**
     * 导出excel
     *
     * @param request
     * @param param
     */
    @RequestMapping(value = "/exportXls")
    @DS("history")
    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, @RequestParam  Map<String, Object> param) {
        return iMesCalculateScrapNumService.exportXls(request,response, param);
    }
}
